package org.singledog.form.builder.parser.freemarker.view.dataset;

import org.singledog.form.builder.datasource.dto.DatagridDataSource;
import org.singledog.form.builder.datasource.dto.Pagination;

import java.util.ArrayList;
import java.util.Map;

public class SimpleDataGridDataset implements DatagridDataSource<SimpleEntity> {
    @Override
    public Pagination<SimpleEntity> getData(String datasetCode, Map<String, Object> params) {

        Pagination<SimpleEntity> pagination = new Pagination<>();
        pagination.setTotal(1000L);
        pagination.setData(new ArrayList<>());
        pagination.getData().add(new SimpleEntity("2016-01-01", "张三", "北京"));
        pagination.getData().add(new SimpleEntity("2016-01-02", "张三1", "北京1"));
        pagination.getData().add(new SimpleEntity("2016-01-03", "张三2", "北京2"));
        pagination.getData().add(new SimpleEntity("2016-01-04", "张三3", "北京3"));
        pagination.getData().add(new SimpleEntity("2016-01-05", "张三4", "北京4"));
        pagination.getData().add(new SimpleEntity("2016-01-06", "张三5", "北京5"));

        return pagination;
    }
}
